package com.vinaprime.primeschedule.presentation;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CropOptionAdapter extends ArrayAdapter<CropOption>{
	private ArrayList<CropOption> cropOption;
	private LayoutInflater inflater;
	public CropOptionAdapter(Context context, ArrayList<CropOption> objects) {
		super(context, R.layout.activity_vpcontact_crop_selector, objects);
		// TODO Auto-generated constructor stub
		cropOption = objects;
		inflater = LayoutInflater.from(context);
	}
	@Override
	public View getView(int position, View convertView, ViewGroup group){
		if(convertView ==null)
			convertView = inflater.inflate(R.layout.activity_vpcontact_crop_selector, null);
			CropOption item =  cropOption.get(position);
			if (item != null){
				((ImageView)convertView.findViewById(R.id.iv_icon)).setImageDrawable(item.icon);
				((TextView)convertView.findViewById(R.id.tv_name)).setText(item.title);
				return convertView;
			}
		return null;
		
	}
	
	

}
